#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
#define endl '\n'
typedef long long LL;
typedef pair<int, int> PII;

int cntmax = 0;
int n;
string s;
LL gcd(LL a, LL b)
{
	return b == 0 ? a : gcd(b, a % b);
}

bool check(int len, int cnt)
{
	int cntcur = 0;
	unordered_map<char, int> mp;
	for(int i = 0; i <= len - 1; i++)
	{
		if(!mp[s[i]]) cntcur++;
		mp[s[i]]++;
	}
	for(int i = 0, j = i + len - 1; j < n && i < n; i++, j++)
	{
		if(cntcur >= cnt) return true;
		if(j + 1 < n)
		{
			mp[s[i]]--;
			if(mp[s[i]] == 0) cntcur--;
		}
		if(mp[s[j + 1]] == 0) cntcur++;
		mp[s[j + 1]]++;
	}
	return false;
}

void solve()
{
	cin >> s;
	n = s.size();
	if (n == 1) 
	{
		cout << 1 << ' ' << 1 << endl;
		return;
	}

	unordered_map<char, int> mp;
	for (auto ch : s)
	{
		if (mp.count(ch)) continue;
		mp[ch]++;
		cntmax++;
	}
	double tmp = 0;
	int ansa = 0, ansb = 0;
	for (int i = 1; i <= cntmax; i++)
	{
		int l = 1, r = n;
		while (l < r)
		{
			int mid = (l + r) >> 1;
			if (check(mid, i))
			{
				r = mid;
			}
			else l = mid + 1;
		}
		double c = i * i * 1.0 / l;
		if(c > tmp)
		{
			tmp = c;
			ansa = i * i;
			ansb = l;
		}
	}
	int p = gcd(ansa, ansb);
	cout << ansa / p << " " << ansb / p << endl;
}

int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T = 1;
	// cin >> T;
	while (T--)
	{
		solve();
	}
	return 0;
}